<!--
 * @Author: daidai
 * @Date: 2022-01-12 14:23:32
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2022-09-09 14:47:24
 * @FilePath: \web-pc\src\pages\big-screen\view\home.vue
-->
<template>
  <div class="outer">
    <ScaleScreen :width="1920" :height="1080" class="scale-wrap">
      <div class="bg">
        <dv-loading v-if="loading">Loading...</dv-loading>
        <div v-else class="host-body">
          <div class="d-flex jc-center title_wrap">
            <div class="zuojuxing"></div>
            <div class="youjuxing"></div>
            <div class="guang"></div>
            <div class="d-flex jc-center">
              <div class="title topTitle">
                <div class="title-left">{{ recordsName }}</div>
                <span class="title-text title-middle">OSCE系统考试驾驶舱</span>
                <div class="title-right">
                  <div>{{ yearMonthDay }}</div>
                  <div style="padding:0 14px 0 10px;">{{ weekday }}</div>
                  <div><flip-clock /></div>
                </div>
              </div>
            </div>
            <div class="timers">
              {{ dateYear }} {{ dateWeek }} {{ dateDay }}
              <i class="blq-icon-shezhi02" style="margin-left: 10px"></i>
            </div>
          </div>
          <div class="inner">
            <div class="innerTop">
              <dv-border-box-13 style="height: 220px;">
                <div class="user_Overview flex">
                  <div class="user_Overview-item" style="color: #00fdfa">
                    <div class="user_Overview_nums allnum ">
                      {{ count.totalStudentNumber === null ? '暂无' : count.totalStudentNumber }}
                      <!-- <dv-digital-flop v-if="loadFlag" :config="totalStudentNumber" style="width:100%;height:100%;" /> -->
                    </div>
                    <p>参加总考生数</p>
                  </div>
                  <div class="user_Overview-item" style="color: #00fdfa">
                    <div class="user_Overview_nums allnum">
                      {{ count.unPassStudentCount === null ? '暂无' : count.unPassStudentCount }}
                      <!-- <dv-digital-flop v-if="loadFlag2" :config="unPassStudentCount" style="width:100%;height:100%;" /> -->
                    </div>
                    <p> {{ type === 'A类' ? '不通过人数' : '不及格人数' }}</p>
                  </div>
                  <div class="user_Overview-item" style="color: #00fdfa">
                    <div class="user_Overview_nums allnum">
                      {{ count.passStudentPercent === null ? '暂无' : count.passStudentPercent }}
                      <!-- <dv-digital-flop v-if="loadFlag2" :config="passStudentPercent" style="width:100%;height:100%;" /> -->
                    </div>
                    <p> {{ type === 'A类' ? '通过率' : '及格率' }}</p>
                  </div>
                  <div class="user_Overview-item" style="color: #00fdfa">
                    <div class="user_Overview_nums allnum">
                      {{ count.totalTeacherNumber === null ? '暂无' : count.totalTeacherNumber }}
                      <!-- <dv-digital-flop v-if="loadFlag" :config="totalTeacherNumber" style="width:100%;height:100%;" /> -->
                    </div>
                    <p>考官数</p>
                  </div>
                  <div class="user_Overview-item" style="color: #00fdfa">
                    <div class="user_Overview_nums allnum">
                      {{ count.totalStationNumber === null ? '暂无' : count.totalStationNumber }}
                      <!-- <dv-digital-flop v-if="loadFlag" :config="totalStationNumber" style="width:100%;height:100%;" /> -->
                    </div>
                    <p>考站数</p>
                  </div>
                  <div class="user_Overview-item" style="color: #00fdfa">
                    <div class="user_Overview_nums allnum">
                      {{ count.totalExamNumber === null ? '暂无' : count.totalExamNumber }}
                      <!-- <dv-digital-flop v-if="loadFlag" :config="totalExamNumber" style="width:100%;height:100%;" /> -->
                    </div>
                    <p>考题数</p>
                  </div>
                </div>
              </dv-border-box-13>
            </div>
            <div class="innerBottom">
              <div class="botLeft">
                <dv-border-box-13 style="height: 750px;">
                  <left-center></left-center>
                </dv-border-box-13>
              </div>
              <div class="botMiddle">
                <dv-border-box-13 style="height: 750px;">
                  <middle-center></middle-center>
                </dv-border-box-13>
              </div>
              <div class="botRight">
                <dv-border-box-13 style="height: 750px;">
                  <div class="top" style="padding: 20px 10px 0 24px;">
                    <div class="top_bg">
                      <a-map ref='aMaps'></a-map>
                    </div>
                    <!-- <iframe style="height: 450px;width: 600px;border: none;" src='http://keshihua.51qingtian.com/#/release?releaseId=2b2f4cd945dc42f490d25b201da0c2e1'></iframe> -->
                  </div>
                  <div class="bottom">
                    <right-center-bottom></right-center-bottom>
                  </div>
                </dv-border-box-13>
              </div>
            </div>
          </div>
        </div>
      </div>
    </ScaleScreen>
  </div>
</template>

<script>
import ScaleScreen from '../historyCockpit/scale-screen/scale-screen.vue'
import leftCenter from './components/left-center.vue'
import middleCenter from './components/middle-center.vue'
import rightCenterBottom from './components/right-center-bottom.vue'
import aMap from './components/a-map.vue'
import { fetchList } from '@/api/examTest.js'
import { unPassCountAndPercent } from '@/api/driver.js'
import FlipClock from 'kuan-vue-flip-clock'
import moment from 'moment'
import { queryMap } from '@/api/index.js'
let style = {
  fontSize: 30
}
export default {
  components: {
    ScaleScreen,
    leftCenter,
    middleCenter,
    rightCenterBottom,
    FlipClock,
    aMap
  },
  data () {
    return {
      loading: false,
      dateDay: null,
      dateYear: null,
      dateWeek: null,
      loadFlag: false,
      loadFlag2: false,
      weekdayArr: ['周日', '周一', '周二', '周三', '周四', '周五', '周六'],
      yearMonthDay: '',
      weekday: '',
      recordsId: '',
      type: '',
      recordsName: '',
      count: {
        passStudentPercent: '',
        unPassStudentCount: '',
        totalStudentNumber: '',
        totalTeacherNumber: '',
        totalStationNumber: '',
        totalExamNumber: ''
      },
      totalStudentNumber: {
        number: [0],
        content: '{nt}',
        style: {
          ...style,
            // stroke: "#00fdfa",
          fill: '#00fdfa'
        }
      },
      unPassStudentCount: {
        number: [0],
        content: '{nt}',
        style: {
          ...style,
          // stroke: "#00fdfa",
          fill: '#00fdfa'
        }
      },
      passStudentPercent: {
        number: [0],
        content: '{nt}',
        style: {
          ...style,
          // stroke: "#00fdfa",
          fill: '#00fdfa'
        }
      },
      totalTeacherNumber: {
        number: [0],
        content: '{nt}',
        style: {
          ...style,
          // stroke: "#00fdfa",
          fill: '#00fdfa'
        }
      },
      totalStationNumber: {
        number: [0],
        content: '{nt}',
        style: {
          ...style,
          // stroke: "#00fdfa",
          fill: '#00fdfa'
        }
      },
      totalExamNumber: {
        number: [0],
        content: '{nt}',
        style: {
          ...style,
          // stroke: '#00fdfa',
          fill: '#00fdfa'
        }
      }
    }
  },
  computed: {},
  created () {
    this.recordsId = this.$route.query.recordsId
    this.type = this.$route.query.type
    this.recordsName = this.$route.query.recordsName
    setTimeout(() => {
      this.getExamResultRecordsCount()
      this.getUnPassCountAndPercent()
      this.getQueryMap()
    }, 10)
    this.getTime()
  },
  mounted () {
  },
  beforeDestroy () {
  },
  methods: {
    getQueryMap () {
      let params = {
        recordsId: this.recordsId
      }
      queryMap(params).then(res => {
        console.log(res)
      })
    },
    // 获取时间
    getTime () {
      let newDate = new Date()
      this.weekday = this.weekdayArr[moment(newDate).weekday()]
      this.yearMonthDay = moment(newDate).format('YYYY-MM-DD')
    },
    getUnPassCountAndPercent () {
      this.loadFlag2 = false
      unPassCountAndPercent({ recordsId: this.recordsId }).then(res => {
        let obj = res.data.data[0]
        console.log('obj', obj)
        this.count.unPassStudentCount = obj.unPassStudentCount
        this.count.passStudentPercent = Number(obj.passStudentPercent).toFixed(2)
        // this.unPassStudentCount.number = [obj.unPassStudentCount]
        // this.passStudentPercent.number = [obj.passStudentPercent]
        this.loadFlag2 = true
      })
    },
    getExamResultRecordsCount () {
      this.loadFlag = false
      fetchList({ id: this.recordsId }).then(res => {
        let obj = res.data.page.records[0]
        this.count.totalStudentNumber = obj.totalStudentNumber
        this.count.totalTeacherNumber = obj.totalTeacherNumber
        this.count.totalStationNumber = obj.totalStationNumber
        this.count.totalExamNumber = obj.totalExamNumber
        // this.totalStudentNumber.number = [obj.totalStudentNumber]
        // this.totalTeacherNumber.number = [obj.totalTeacherNumber]
        // this.totalStationNumber.number = [obj.totalStationNumber]
        // this.totalExamNumber.number = [obj.totalExamNumber]
        this.loadFlag = true
      })
    }
  }
}
</script>

<style lang="scss">
@import "./components/home.scss";
.dv-border-svg-container{
  position: absolute !important;
}
.outer {
  height: 100vh;
  width: 100vw;
  background: #03050C;

  .inner {
    display: flex;
    flex-direction: column;
    height: 100%;

    .innerTop {
      height: 220px;
      width: 100%;
      margin-bottom: 10px;
    }

    .innerBottom {
      width: 100%;
      height: 750px;
      display: flex;

      .botLeft {
        width: 30%;
        height: 750px;

      }

      .botMiddle {
        width: 35%;
        height: 750px;
        margin: 0 20px;
      }

      .botRight {
        width: 35%;
        height: 750px;
        .top{
          height: 410px;
          width: 100%;
          .top_bg{
            height: 100%;
            width: 90%;
            margin: 0 auto;
            background-size: 100% 100%;
          }
        }
        .bottom{
          height: 330px;
          width: 100%;
        }
      }
    }
  }
}
</style>
<style lang='scss' scoped>
.user_Overview {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding-top: 20px;
  .user_Overview-item {
    height: 200px;
    width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    p {
      text-align: center;
      height: 16px;
      font-size: 26px;
    }

    .user_Overview_nums {
      width: 120px;
      height: 120px;
      text-align: center;
      line-height: 120px;
      font-size: 26px;
      // margin: 50px auto 30px;
      background-size: cover;
      background-position: center center;
      position: relative;

      &::before {
        content: '';
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
      }

      &.bgdonghua::before {
        animation: rotating 14s linear infinite;
      }
    }
    .allnum {
      background-image: url("~@/assets/img/left_top_lan.png");

      // &::before {
      //   background-image: url("~@/assets/img/left_top_lan.png");
      // }
    }
    .online {
      background-image: url("~@/assets/img/left_top_lv.png");
      // &::before {
      //   background-image: url("~@/assets/img/left_top_lv.png");
      // }
    }
    .offline {
      background-image: url("~@/assets/img/left_top_huang.png");
      // &::before {
      //   background-image: url("~@/assets/img/left_top_huang.png");
      // }
    }
    .laramnum {
      background-image: url("~@/assets/img/left_top_hong.png");
      // &::before {
      //   background-image: url("~@/assets/img/left_top_hong.png");
      // }
    }
  }
}
</style>
<style lang="scss">
.topTitle{
  display: flex;
  .title-left{
    padding-left: 20px;
    padding-right: 140px;
    padding-top: 10px;
    width: 30%;
    font-size: 22px !important;
    color: #01AAFF;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 24px;
    font-weight: 500;
  }
  .title-middle{
    flex: 1;
  }
  .title-right{
    padding-left: 120px;
    padding-right: 10px;
    padding-top: 10px;
    width: 30%;
    font-size: 22px !important;
    color: #01AAFF;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 24px;
    display: flex;
  }
}
// 时钟 ⏰
.test-clock-container {
  font: normal 14px "Helvetica Neue", Helvetica, sans-serif;
  user-select: none;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.3);
  background: radial-gradient(ellipse at center, #969696 0%, #595959 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.flip{
  height: 30px !important;
  line-height: 30px !important;
  width: 20px !important;
  border-radius: 2px !important;
  padding: 0 !important;
  margin: 0 2px !important;
  .item{
    .inn{
      font-size: 18px !important;
      color: #01AAFF !important;
    }
  }
} 
.colon{
  padding: 0 2px !important;
  height: 26px !important;
} 
.colon:before{
  background: #01AAFF80 !important;
  height: 6px !important;
  width: 6px !important;
}
.colon:after{
  background: #01AAFF80 !important;
  height: 6px !important;
  width: 6px !important;
}
</style>